home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Reversed wipes ƒ / Diagonal wipe down-right.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-11  |  2.4 KB  |  79 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Diagonal wipe down-right.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 2
  32. #define theWindowWidth (boundsRect.right-boundsRect.left)
  33. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  34.  
  35. pascal short DiagonalWipeDownRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  36.  
  37. /* If you make a long enough region starting at the top-left corner and
  38.    making a strip up and right of <BoxSize> width, all you have to do is move
  39.    the region down until the entire screen is filled.  Dave thinks ideas like
  40.    this should be taken out and shot, but it works. */
  41.    
  42. pascal short DiagonalWipeDownRight(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  43. {
  44.     int                maxmax;
  45.     RgnHandle        archie;
  46.     int                BoxSize;
  47.     Point            zeroPoint;
  48.     
  49.     zeroPoint.h=boundsRect.right;
  50.     zeroPoint.v=boundsRect.bottom;
  51.     
  52.     BoxSize=theWindowWidth/40;
  53.     
  54.     maxmax=(theWindowWidth>theWindowHeight) ? theWindowWidth : theWindowHeight;
  55.     maxmax+=BoxSize;
  56.     archie=NewRgn();
  57.     OpenRgn();
  58.         MoveTo(boundsRect.left-BoxSize, boundsRect.top);
  59.         Line(0,-BoxSize);
  60.         Line(maxmax,-maxmax);
  61.         Line(BoxSize,0);
  62.         Line(-maxmax,maxmax);
  63.     CloseRgn(archie);
  64.  
  65.     do
  66.     {
  67.         StartTiming();
  68.         OffsetRgn(archie,0,BoxSize);
  69.         CopyBits(&(sourceGrafPtr->portBits),&(destGrafPtr->portBits),
  70.             &boundsRect,&boundsRect,0,archie);
  71.         TimeCorrection(CorrectTime);
  72.     }
  73.     while (!PtInRgn(zeroPoint, archie));
  74.     
  75.     DisposeRgn(archie);
  76.     
  77.     return 0;
  78. }
  79.